package com.example.groupmeal.config.webConfig;

import java.util.HashMap;
import java.util.Map;

import com.example.groupmeal.utils.Result;
import com.example.groupmeal.utils.ResultCode;

/*
 * 接口基类
 */
public class ApiBase<T> {
	
	public static Result<?> success(Object data) {
		Map<String, Object> map = new HashMap<>();
		map.put("content", data);
		return new Result<>(ResultCode.SUCCESS, map);
	}
	
	public static Result<?> error(String msg) {
        return new Result<>(ResultCode.ERROR, msg);
	}
	
	public static Result<?> placeOrderError(String msg) {
        return new Result<>(ResultCode.PLACE_ORDER_ERROR, msg);
	}
	
	public static Result<?> tokenError(String msg) {
        return new Result<>(ResultCode.TOKEN_ERROR, msg);
	}

}
